#pragma once
#include <QVector>
#include <QWidget>

#include "AppMenuItem.h"

class QJsonObject;
class AppMenuItem;

struct MenuCategory {
  int id = -1;
  QString title;
  QVector<AppMenuItem*> items;
};

class AppMenuCategoryPanel : public QWidget {
 public:
  AppMenuCategoryPanel(QJsonObject* data, QWidget* parent = nullptr);

  int cmdCount() const { return m_category.items.size(); }
  void addCmd(int id);
  void removeCmd(int id);
  bool hasCmd(int id);
  bool isFavePanel();
  bool isIasPanel();
  bool isRedPoint();
  void removeRedPoint();

 protected:
  void paintEvent(QPaintEvent* event) override;

 private:
  void construct(QJsonObject* data);

 private:
  MenuCategory m_category;
  QWidget* m_commonWidget = nullptr;
};